﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("BC")]
namespace BE.Abastos
{
    public class Category
    {
        public int? iProductCategoryId { get; set; }
        public string sCategoryName { get; set; }
        public int? iProductCategoryParentId { get; set; }
        public string sDescription { get; set; }
        public DateTime dtModifies { get; set; }

        internal Category Create()
        {
            try
            {
                Category result = new Category();

                using (DAL.Abastos.CategoriasDA<Category> datos = new DAL.Abastos.CategoriasDA<Category>())
                {
                    result = datos.Create(this.sCategoryName,
                        this.iProductCategoryParentId,
                        this.sDescription);
                }
                return result;
            }
            catch (Exception ex)
            {
                throw new AppException ("Category - Create - ", ex);
            }
        }
        internal List<Category> Select()
        {
            try
            {
                List<Category> result = new List<Category>();

                using (DAL.Abastos.CategoriasDA<Category> datos = new DAL.Abastos.CategoriasDA<Category>())
                {
                    result = datos.Select(this.iProductCategoryId,
                        this.sCategoryName,
                        this.iProductCategoryParentId,
                        this.sDescription);
                }
                return result;
            }
            catch (Exception ex)
            {
                throw new AppException("Category - Select - ", ex);
            }
        }
    }
}
